home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13365 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: news.internex.net.au!usenet
  2. From: sultan@connexus.apana.org.au (Jon Hornstein)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: malloc question
  5. Date: Mon, 08 Apr 1996 08:16:28 GMT
  6. Organization: connexus.apana.org.au
  7. Message-ID: <4k8mf0$39c@preeda.internex.net.au>
  8. References: <4k6tgn$13c8@pulp.ucs.ualberta.ca>
  9. NNTP-Posting-Host: dialin-30.internex.net.au
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. malloc expects a numeric size_t as a parameter indicating how large a
  13. chunk of memory to allocate. 
  14. I hope frames, whatever it is refers to a variable that contains a
  15. value that at least represents the number of bytes you require which I
  16. suppose in this case is sizeof(unsigned long int) * 100.
  17.  
  18. Catch yer
  19.  
  20. Jon
  21.  
  22.  
  23. hcolquho@gpu3.srv.ualberta.ca (Harry Colquhoun) wrote:
  24.  
  25. >Not quite sure what's happening here, most likely something real stupid I 
  26. >did, I'm sure.
  27.  
  28. >compiled using djgpp under MSDOS->works fine
  29. >compiled using djgpp on SGI->core dump 
  30.  
  31. >-------------------------
  32. >global variable 'frames'
  33.  
  34. >the problem:
  35.  
  36. >unsigned long int *mem;
  37. >mem = (unsigned long int *) malloc (frames);
  38. >-------------------------
  39.  
  40. >changing to 'unsigned long int mem[100]' and no malloc fixes problem
  41.  
  42.  
  43. >Anyone know why?
  44.  
  45. >Harry.
  46. >(email me please)
  47.  
  48. >--
  49. >------------------------------------------------------------------------------
  50. >DEEP THOUGHTS: "If trees could scream, would you still cut them down?...
  51. >        Well, you would if they screamed all the time."
  52. >------------------------------------------------------------------------------
  53.  
  54.  
  55.